package com.sean.designpatterns.create.prototype;

import java.util.Hashtable;

public class ShapeCache {
    private static Hashtable<String,Shape> shapeMap= new Hashtable<>();
    public static Shape getShaper(String  shapeId){
        return (Shape) shapeMap.get(shapeId).clone();
    }

    public static void loadCache(){
        Circle circle = new Circle();
        circle.setId("1");
        shapeMap.put(circle.getId(),circle);

        Retangle retangle = new Retangle();
        retangle.setId("2");
        shapeMap.put(retangle.getId(),retangle);
    }
}
